#ifndef __buzzer_h
#define __buzzer_h

#ifdef APM32E10X_HD
	#include  "apm32e10x_gpio.h" 
	#include  "apm32e10x_rcm.h"	
	
#elif defined AT32F403AVGT7
	#include "at32f403a_407_gpio.h" 
  #include "at32f403a_407_crm.h"		
	
#else
	#include  "apm32f10x_gpio.h" 
	#include  "apm32f10x_rcm.h" 
	
#endif

#include  "SQDriConfig.h"



/////// 有源蜂鸣器 ////////
#if defined SQDri_EVSEB_11KW
	//引脚块1 = 接引脚块 = PB7
	#define buzzer_RCM              RCM_APB2_PERIPH_GPIOB
	#define buzzer_PinPort          GPIOB
	#define buzzer_PinId            GPIO_PIN_7

#elif defined SQDri_EVSEB_7KW 

  //引脚块1 = 接引脚块 = PB7
	#define buzzer_RCM              RCM_APB2_PERIPH_GPIOB
	#define buzzer_PinPort          GPIOB
	#define buzzer_PinId            GPIO_PIN_7

#else

	//引脚块1 = 接引脚块 = PB2
	#define buzzer_RCM              RCM_APB2_PERIPH_GPIOB
	#define buzzer_PinPort          GPIOB
	#define buzzer_PinId            GPIO_PIN_2


#endif


///////// 函数定义 /////////
#define buz_bit_set(x)          buzzer_PinPort -> BC  = x     
#define buz_bit_reset(x)        buzzer_PinPort -> BSC = x      

// 蜂鸣器鸣叫
#define startBeep()             buz_bit_reset(buzzer_PinId)
// 蜂鸣器停止鸣叫
#define stopBeep()              buz_bit_set(buzzer_PinId)

//// 函数定义 ////
void buzzer_init(void);

#if beep_type == beep_APM
// 启动蜂鸣器鸣叫：
void beep_start(uint8_t beep_times,uint16_t beep_Tm,uint16_t beep_idle_Tm);
void beep_step_run(void);
#endif

#endif

